package org.eclipse.stp.policy_builder.model.source.wizards;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.stp.policy_builder.model.IMessage;
import org.eclipse.stp.policy_builder.model.source.SourceType;
import org.eclipse.swt.graphics.Image;

public class MessageLabelProvider extends LabelProvider implements
ITableLabelProvider {

	@Override
	public Image getColumnImage(Object element, int columnIndex) {
		// TODO Auto-generated method stub
		
		return null;
	}

	@Override
	public String getColumnText(Object element, int columnIndex) {
		// TODO Auto-generated method stub
		if(element instanceof IMessage){
			IMessage current = (IMessage) element;
			
			switch(columnIndex){
				case 0 :
					return current.getID() ;
				case 1:
					return current.getSourceName() ;
				case 2:
					return current.getDescription() ;
				default :
					return "" ;
			}				
		}
		
		if (element == null)
	         return "<null>";
	      try {
	         return element.toString();
	      }
	      catch (Exception e) {
	         return e.toString();
	     }
		
	}

}
